package com.chai.service.impl;

import com.chai.dao.User;
import com.chai.service.BookService;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
/**
 * setter方式：简单类型的注入和引用类型的注入
 * */
public class BookServiceImpl implements BookService, InitializingBean, DisposableBean {
    public User user;
    public int max;

    public void setMax(int max) {
        this.max = max;
    }

    public void setUser(User user) {
        this.user = user;
    }
    public void save(){
        user.print();
    }

    public void execute() {
        System.out.println("执行成功！");
    }



    public void destroy() throws Exception {
        System.out.println("标准销毁Bean后的执行方法");
    }
    //该方法在属性设置之后执行
    public void afterPropertiesSet() throws Exception {
        System.out.println("Bean的初始化方法");
    }
}
